package com.ruoyi.hr.service.impl.depinfo;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.hr.domain.Authority;
import com.ruoyi.hr.mapper.depinfo.DepInfoMapper;
import com.ruoyi.hr.service.depinfo.DepInfoService;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class DepInfoServiceImpl extends BaseController implements DepInfoService {

    @Autowired
    DepInfoMapper depInfoMapper;

    @Autowired
    SysUserMapper sysUserMapper;


    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Map<String, Object>> findData(Map map, Authority authority) {
        SysUser user = ShiroUtils.getSysUser();
        Map<String, Object> maps = sysUserMapper.selectSkySecUser(user.getLoginName());
        String urid = maps.get("id").toString();
        map.put("urid", urid);
        startPage();
        return depInfoMapper.findData(map,authority);
    }
}
